package com.wanjia.estate.constant;

import lombok.AllArgsConstructor;

import java.util.Objects;
import java.util.stream.Stream;

@AllArgsConstructor
public enum GyfsType {

    GYFS0("0", "单独所有"),
    GYFS1("1", "共同共有"),
    GYFS2("2", "按份共有"),
    GYFS3("3", "其它共有");

    private final String code;
    private final String name;

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static GyfsType get(String code) {
        return Stream.of(values())
                .filter(d -> Objects.equals(code, d.code))
                .findFirst()
                .orElse(null);
    }
}
